package it.kion.util.ui.ulog2.editor.scanners;

import org.eclipse.jface.text.rules.*;

public class FormatRule implements IRule
{
   private final IToken token;

   public FormatRule(IToken token)
   {
      this.token = token;
   }

   public IToken evaluate(ICharacterScanner scanner)
   {
      int c = scanner.read();
      if (c == '%')
      {
         do
         {
            c = scanner.read();
         }
         while (c != ICharacterScanner.EOF
            && (Character.isLetterOrDigit((char) c)
               || c == '-'
               || c == '.'));
         scanner.unread();

         return token;
      }
      scanner.unread();
      return Token.UNDEFINED;
   }
}
